<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>修改视界</title>
<%@ include file="commons/meta.jsp"%>
<%@ include file="commons/tags.jsp"%>
<!-- 
<link href="${ctx}/css/form.css" rel="stylesheet" type="text/css" />
 -->
<link href="${ctx}/js/uploadify/uploadify.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="${ctx}/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript"
	src="${ctx}/js/uploadify/jquery.uploadify-3.1.js"></script>
<script type="text/javascript" src="${ctx}/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="${ctx}/js/ckfinder/ckfinder.js"></script>
<script src="${ctx}/js/ckeditor/sample.js" type="text/javascript"></script>
<link href="${ctx}/css/ckeditor/sample.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="${ctx}/js/jquery.validate.js"></script>
<script type="text/javascript">
	$(function() {
		$("#videoFile").uploadify({
			height : 30,
			swf : '${ctx}/js/uploadify/uploadify.swf',
			uploader : '${ctx}/shijie/uploadFile?type=video',
			width : 120,
			fileTypeDesc : 'video files',
			fileTypeExts : '*.mp4',
			buttonText : '浏览',
			onUploadSuccess : function(file, data, response) {
				$("#filepath").attr("value", data);
			}
		});

		$("#picFile").uploadify(
				{
					height : 30,
					swf : '${ctx}/js/uploadify/uploadify.swf',
					uploader : '${ctx}/shijie/uploadFile?type=pic',
					width : 120,
					fileTypeDesc : 'image files',
					fileTypeExts : '*.gif; *.jpg; *.png;*.GIF; *.JPG; *.PNG',
					buttonText : '浏览',
					onUploadSuccess : function(file, data, response) {
						$("#videoPic").attr("src",
								"${ctx}/userfiles/videoPic/" + data);
						$("#firstframepic").attr("value", data);
					}
				});
	});

	$.validator.setDefaults({
		ignore : ''
	});

	$().ready(function() {
		// validate signup form on keyup and submit
		$("#signupForm").validate({
			rules : {
				title : "required",
				jianjie : "required",
				weight : {
					required : true,
					number : true
				},
				lanmu : "required",
				filepath : "required",
				firstframepic : "required",
				content : "required"
			},
			messages : {
				title : "请输入视频标题",
				jianjie : "请输入视频简介",
				weight : {
					required : "请输入视频权重",
					number : "请输入数字"
				},
				lanmu : "请选择栏目",
				filepath : "请上传视频文件",
				firstframepic : "请上传视频图片文件",
				content : "请输入视频详细内容"
			}
		});
	});
</script>
</head>
<body>
	<div id="container">
		<div id="middlecontent">
			<form id="signupForm" action="${ctx}/shijie/update" method="post">
				<div id="divform">
					<input type="hidden" id="shijieId" name="shijieId" class="input"
						value="${model.shijieId }" />
					<div class="fielddiv">
						<label> 视频标题: </label> <input type="text" id="title" name="title"
							class="input" value="${model.title }" />
					</div>
					<div class="fielddiv">
						<label> 视频简介: </label>
						<textarea cols="50" rows="5" id="jianjie" name="jianjie"
							class="input">${model.jianjie}</textarea>
					</div>
					<div class="fielddiv">
						<label> 权重: </label> <input type="text" id="weight" name="weight"
							class="input" value="${model.weight}" />
					</div>
					<div class="fielddiv">
						<label> 栏目: </label> <select name="flanmu" class="input">
							<c:forEach items="${applicationScope.firstLanmu}" var="flanmu">
								<option value="${flanmu.id}"
									<c:if test="${flanmu.id eq fLanmu.id }">selected="selected"</c:if >>${flanmu.name}</option>
							</c:forEach>
						</select> <br /> <br /> <label> 二级栏目: </label>
						<table class="input">
							<tr>
								<c:forEach items="${sLanmu}" var="slanmu">
									<td><input type="checkbox" id="lanmu" name="lanmu"
										value="${slanmu.id }"
										<c:if test="${slanmu.seleted }"> checked="checked"</c:if> />&nbsp;${slanmu.name
										}</td>
								</c:forEach>
							</tr>
						</table>
					</div>
					<div class="fielddiv">
						<label> 视频文件: </label> <input type="file" name="videoFile"
							id="videoFile" /> <input type="hidden" id="filepath"
							name="filepath" value="${model.filepath}" />
					</div>
					<div class="fielddiv">
						<label> 视频截图: </label> <input type="file" name="picFile"
							id="picFile" /> <input type="hidden" id="firstframepic"
							name="firstframepic" value="${model.firstframepic}" />
						<c:if var="pic" test="${empty model.firstframepic}">
							<img id="videoPic" src="${ctx }/images/video_demo.jpg"
								width="400" height="300" alt="预览截图" />
						</c:if>
						<c:if test="${not pic }">
							<img id="videoPic"
								src="${ctx }/userfiles/videoPic/${model.firstframepic}"
								width="400" height="300" alt="预览截图" />
						</c:if>
					</div>
					<!-- 
					<div class="fielddiv">
						<label> 发布者: </label> <input type="text" name="dpassword"
							class="input" />
					</div>
					 -->
					<div class="fielddiv">
						<label> 内容: </label>
					</div>
				</div>
				<div class="editordiv">
					<textarea id="content" name="content" class="ckeditor">${model.content }</textarea>
				</div>

				<div class="center">
					<input type="submit" value="提交" class="buttom" /> <input
						type="reset" value="清空" class="buttom" />
				</div>

			</form>
		</div>
	</div>
	<script type="text/javascript">
		CKEDITOR.replace('content');
		CKFinder.setupCKEditor(editor, 'ckfinder/');
	</script>
</body>
</html>